<?php
/**
 * crpCasa
 *
 * @copyright (c) 2009-2010 Daniele Conca
 * @link http://code.zikula.org/crpcasa Support and documentation
 * @author Daniele Conca <conca.daniele@gmail.com>
 * @license GNU/LGPL - v.3
 * @package crpCasa
 */


Loader :: includeOnce('modules/crpCasa/pnclass/crpCasa.php');

/**
 * the main administration function
 *
 * @return string HTML output
 */
function crpCasa_user_main()
{
	// Security check
	if (!SecurityUtil :: checkPermission('crpCasa::', '::', ACCESS_READ))
	{
		return LogUtil :: registerPermissionError();
	}

	// Create output object
	$pnRender = new pnRender('crpCasa');

	// Return the output that has been generated by this function
	return $pnRender->fetch('crpcasa_user_main.htm');
}

/**
 * view complete gallery
 *
 * @return string HTML output string
 */
function crpCasa_user_view_albums()
{
	// Security check
	if (!SecurityUtil :: checkPermission('crpCasa::', '::', ACCESS_READ))
	{
		return LogUtil :: registerPermissionError();
	}

	$crpcasa = new crpCasa();
	return $crpcasa->viewAlbums();
}

/**
 * view a single album
 *
 * @return string HTML output string
 */
function crpCasa_user_view_album()
{
	// Security check
	if (!SecurityUtil :: checkPermission('crpCasa::', '::', ACCESS_READ))
	{
		return LogUtil :: registerPermissionError();
	}

	$crpcasa = new crpCasa();
	return $crpcasa->viewAlbum();
}

/**
 * view a single image
 *
 * @return string HTML output string
 */
function crpCasa_user_view_image()
{
	// Security check
	if (!SecurityUtil :: checkPermission('crpCasa::', '::', ACCESS_READ))
	{
		return LogUtil :: registerPermissionError();
	}

	$crpcasa = new crpCasa();
	return $crpcasa->viewImage();
}